<template>
  <div>
    <h1>我是个人中心组件</h1>
    <!-- 动态组件
    is="组件名称" -->
    <button @click="componentId='Login'">登录</button>
    <button @click="componentId='Reg'">注册</button>
    <keep-alive :include="'Login'"
                :exclude="'Reg'">
      <component :is="componentId"></component>
    </keep-alive>
  </div>
</template>
<script>
import Login from '../views/Login.vue'
import Reg from '../views/Reg.vue'
export default {
  name: "my",
  components: {
    Login,
    Reg,
  },
  data () {
    return {
      componentId: "Reg"
    }
  }
}
</script>
<style lang="less">
</style>